import React , {Component} from 'react';

import { View, Text, ListView, StyleSheet, TouchableOpacity} from 'react-native';


export default class ListViewT extends Component{
    constructor(props){
        super(props);
        var ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 });
        this.state = {
            // dataSource: ds.cloneWithRows(['row 1', 'row 2']),
            dataSource: ds.cloneWithRows(this._genRows())
        };
    }

    _genRows(){
        const dataBlob = [];
        for(let i = 0 ; i < 200 ; i++){
            dataBlob.push('aa'+ i);
        }
        return dataBlob;
    }

    _pressRow(rowID){
        console.log("hellow" + rowID);
    }

    _renderRow(rowData , sectionID , rowID){
        return(
            <TouchableOpacity onPress={() => this._pressRow(rowID)}>
                <View>
                    <Text>{'rowData:' + rowData + 'rowId:' + rowID}</Text>
                </View>
            </TouchableOpacity>
        )
    }
    
    render(){
        return(
            <ListView
                dataSource={this.state.dataSource}
                renderRow={this._renderRow.bind(this)}
            />
        )
    }
}

const styles = StyleSheet.create({

})
